﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Drawing.Design;
using Model;
using UIMarker;
using Model.Enum;

namespace UIDesign
{
    public class ItemLabel : Label
    {
        #region

        private string _listid;
        private string _plistid;
        private int _orderid;
        private string _colname;
        private string _headcn;
        private PsDataType _coltype;
        private bool _isquery = true;
        private bool _isshow;
        private string _oname;
        private string _fmt;
        private ControlType _controltype;
        private int _maxlength;
        private int _digits;
        private string _defvalue;
        private bool _iskey;
        private bool _notnull;
        private int _columnwidth;
        private int _colspan;
        private string _columnoption;
        private string _columnparam;
        private string _tp1;
        private string _tp2;
        private string _tp3;
        private string _tp4;
        private string _tp5;
        private string _tp6;
        private string _tp7;
        private string _tp8;
        private string _tp9;
        private string _tp10;
        private string _remark;

        private string _editmode;

        [Category("3Edit")]
        [Description("可编辑模式")]
        [DefaultValue("A,M")]
        public string Editmode
        {
            get { return _editmode; }
            set { _editmode = value; }
        }

        /// <summary>
        /// 主键标识
        /// </summary>
        [BrowsableAttribute(false)]
        public string Listid
        {
            get { return _listid; }
            set { _listid = value; }
        }
        /// <summary>
        /// 页面标识
        /// </summary>
        [BrowsableAttribute(false)]
        public string Plistid
        {
            get { return _plistid; }
            set { _plistid = value; }
        }
        /// <summary>
        /// 序号
        /// </summary>
        [BrowsableAttribute(false)]
        public int Orderid
        {
            get { return _orderid; }
            set { _orderid = value; }
        }

        [Category("1公用属性")]
        [Description("字段名称")]
        public string Colname
        {
            get { return _colname; }
            set { _colname = value; }
        }
        [Category("1公用属性")]
        [Description("中文表头")]
        public string Headcn
        {
            get { return _headcn; }
            set { _headcn = value; this.Text = _headcn; }
        }

        [Category("1公用属性")]
        [Description("类型")]
        [DefaultValue(PsDataType.String)]
        public PsDataType Coltype
        {
            get { return _coltype; }
            set { _coltype = value; }
        }
        [Category("2Main")]
        [Description("是否允许查询")]
        [DefaultValue(true)]
        public bool Isquery
        {
            get { return _isquery; }
            set { _isquery = value; }
        }

        [Category("1公用属性")]
        [Description("是否显示")]
        [DefaultValue(true)]
        public bool Isshow
        {
            get { return _isshow; }
            set { _isshow = value; }
        }
        [Category("2Main")]
        [Description("列别名")]
        public string Oname
        {
            get { return _oname; }
            set { _oname = value; }
        }
        [Category("1公用属性")]
        [Description("格式化")]
        public string Fmt
        {
            get { return _fmt; }
            set { _fmt = value; }
        }
        [Category("3Edit")]
        [Description("控件类型")]
        [DefaultValue(ControlType.Text)]
        public ControlType Controltype
        {
            get { return _controltype; }
            set
            {
                _controltype = value;
                ControlStr = MainHelp.LIST[Convert.ToInt32(_controltype)];
                this.Text = this.Text;
            }
        }

        [Category("1公用属性")]
        [Description("最大长度")]
        [DefaultValue(0)]
        public int Maxlength
        {
            get { return _maxlength; }
            set { _maxlength = value; }
        }
        [Category("1公用属性")]
        [Description("小数精度")]
        [DefaultValue(0)]
        public int Digits
        {
            get { return _digits; }
            set { _digits = value; }
        }
        [Category("3Edit")]
        [Description("默认值")]
        public string Defvalue
        {
            get { return _defvalue; }
            set { _defvalue = value; }
        }
        [Category("1公用属性")]
        [Description("是否主键")]
        [DefaultValue(false)]
        public bool Iskey
        {
            get { return _iskey; }
            set { _iskey = value; }
        }
        [Category("3Edit")]
        [Description("不允许为空")]
        [DefaultValue(true)]
        public bool Notnull
        {
            get { return _notnull; }
            set { _notnull = value; }
        }
        [Category("3Edit")]
        [Description("字段宽度")]
        [DefaultValue(100)]
        public int Columnwidth
        {
            get { return _columnwidth; }
            set { _columnwidth = value; }
        }
        [Category("3Edit")]
        [Description("跨列")]
        [DefaultValue(1)]
        public int Colspan
        {
            get { return _colspan; }
            set { _colspan = value; }
        }
        [Category("3Edit")]
        [Description("选项")]
        public string Columnoption
        {
            get { return _columnoption; }
            set { _columnoption = value; }
        }
        [Category("3Edit")]
        [Description("参数")]
        public string Columnparam
        {
            get { return _columnparam; }
            set { _columnparam = value; }
        }
        [Category("4临时")]
        [Description("临时参数1")]
        public string Tp1
        {
            get { return _tp1; }
            set { _tp1 = value; }
        }
        [Category("4临时")]
        [Description("临时参数2, 弹出框数据源")]
        public string Tp2
        {
            get { return _tp2; }
            set { _tp2 = value; }
        }
        [Category("4临时")]
        [Description("临时参数3")]
        public string Tp3
        {
            get { return _tp3; }
            set { _tp3 = value; }
        }
        [Category("4临时")]
        [Description("临时参数4，明细y唯一约束")]
        public string Tp4
        {
            get { return _tp4; }
            set { _tp4 = value; }
        }
        [Category("4临时")]
        [Description("临时参数5")]
        public string Tp5
        {
            get { return _tp5; }
            set { _tp5 = value; }
        }
        [Category("4临时")]
        [Description("简要说明")]
        public string Remark
        {
            get { return _remark; }
            set { _remark = value; }
        }

        [Category("4临时")]
        [Description("简要说明")]
        public string Tp6
        {
            get { return _tp6; }
            set { _tp6 = value; }
        }

        [Category("4临时")]
        [Description("简要说明")]
        public string Tp7
        {
            get { return _tp7; }
            set { _tp7 = value; }
        }

        [Category("4临时")]
        [Description("简要说明")]
        public string Tp8
        {
            get { return _tp8; }
            set { _tp8 = value; }
        }

        [Category("4临时")]
        [Description("简要说明")]
        public string Tp9
        {
            get { return _tp9; }
            set { _tp9 = value; }
        }

        [Category("4临时")]
        [Description("tp10")]
        public string Tp10
        {
            get { return _tp10; }
            set { _tp10 = value; }
        }


        #endregion

        //private Sys5a01 _tLayout;


        //[Browsable(true)]
        //[Category("1自定义属性")]
        //[Editor(typeof(FrmItem), typeof(UITypeEditor))]
        //public Sys5a01 TLayout
        //{
        //    get { return _tLayout; }
        //    set { _tLayout = value; }
        //}

        private string _controlStr = " [Text] ";

        [BrowsableAttribute(false)]
        public string ControlStr
        {
            get { return _controlStr; }
            set { _controlStr = "【" + value + "】 "; }
        }

        [BrowsableAttribute(false)]
        public override string Text
        {
            get
            {
                return this.ControlStr + base.Text + "(" + this.Colname + ")";
            }
            set
            {
                base.Text = value;
            }
        }

        #region 垃圾代码
        [BrowsableAttribute(false)]
        public override bool AllowDrop
        {
            get
            {
                return base.AllowDrop;
            }
            set
            {
                base.AllowDrop = value;
            }
        }

        [BrowsableAttribute(false)]
        public override AnchorStyles Anchor
        {
            get
            {
                return base.Anchor;
            }
            set
            {
                base.Anchor = value;
            }
        }

        [BrowsableAttribute(false)]
        public override System.Drawing.Point AutoScrollOffset
        {
            get
            {
                return base.AutoScrollOffset;
            }
            set
            {
                base.AutoScrollOffset = value;
            }
        }

        [BrowsableAttribute(false)]
        public override bool AutoSize
        {
            get
            {
                return base.AutoSize;
            }
            set
            {
                base.AutoSize = value;
            }
        }

        [BrowsableAttribute(false)]
        public override System.Drawing.Color BackColor
        {
            get
            {
                return base.BackColor;
            }
            set
            {
                base.BackColor = value;
            }
        }

        [BrowsableAttribute(false)]
        public override System.Drawing.Image BackgroundImage
        {
            get
            {
                return base.BackgroundImage;
            }
            set
            {
                base.BackgroundImage = value;
            }
        }

        [BrowsableAttribute(false)]
        public override ImageLayout BackgroundImageLayout
        {
            get
            {
                return base.BackgroundImageLayout;
            }
            set
            {
                base.BackgroundImageLayout = value;
            }
        }
        [BrowsableAttribute(false)]
        public override BindingContext BindingContext
        {
            get
            {
                return base.BindingContext;
            }
            set
            {
                base.BindingContext = value;
            }
        }
        [BrowsableAttribute(false)]
        public override BorderStyle BorderStyle
        {
            get
            {
                return base.BorderStyle;
            }
            set
            {
                base.BorderStyle = value;
            }
        }
        [BrowsableAttribute(false)]
        protected override bool CanEnableIme
        {
            get
            {
                return base.CanEnableIme;
            }
        }

        [BrowsableAttribute(false)]
        protected override bool CanRaiseEvents
        {
            get
            {
                return base.CanRaiseEvents;
            }
        }
        [BrowsableAttribute(false)]
        public override ContextMenu ContextMenu
        {
            get
            {
                return base.ContextMenu;
            }
            set
            {
                base.ContextMenu = value;
            }
        }
        [BrowsableAttribute(false)]
        public override ContextMenuStrip ContextMenuStrip
        {
            get
            {
                return base.ContextMenuStrip;
            }
            set
            {
                base.ContextMenuStrip = value;
            }
        }
        [BrowsableAttribute(false)]
        protected override CreateParams CreateParams
        {
            get
            {
                return base.CreateParams;
            }
        }
        [BrowsableAttribute(false)]
        protected override Cursor DefaultCursor
        {
            get
            {
                return base.DefaultCursor;
            }
        }
        [BrowsableAttribute(false)]
        public override Cursor Cursor
        {
            get
            {
                return base.Cursor;
            }
            set
            {
                base.Cursor = value;
            }
        }
        [BrowsableAttribute(false)]
        protected override ImeMode DefaultImeMode
        {
            get
            {
                return base.DefaultImeMode;
            }
        }
        [BrowsableAttribute(false)]
        protected override Padding DefaultMargin
        {
            get
            {
                return base.DefaultMargin;
            }
        }
        [BrowsableAttribute(false)]
        protected override System.Drawing.Size DefaultMaximumSize
        {
            get
            {
                return base.DefaultMaximumSize;
            }
        }
        [BrowsableAttribute(false)]
        protected override System.Drawing.Size DefaultMinimumSize
        {
            get
            {
                return base.DefaultMinimumSize;
            }
        }
        [BrowsableAttribute(false)]
        protected override Padding DefaultPadding
        {
            get
            {
                return base.DefaultPadding;
            }
        }
        [BrowsableAttribute(false)]
        protected override System.Drawing.Size DefaultSize
        {
            get
            {
                return base.DefaultSize;
            }
        }
        [BrowsableAttribute(false)]
        public override System.Drawing.Rectangle DisplayRectangle
        {
            get
            {
                return base.DisplayRectangle;
            }
        }
        [BrowsableAttribute(false)]
        public override DockStyle Dock
        {
            get
            {
                return base.Dock;
            }
            set
            {
                base.Dock = value;
            }
        }
        [BrowsableAttribute(false)]
        protected override bool DoubleBuffered
        {
            get
            {
                return base.DoubleBuffered;
            }
            set
            {
                base.DoubleBuffered = value;
            }
        }
        [BrowsableAttribute(false)]
        public override bool Focused
        {
            get
            {
                return base.Focused;
            }
        }
        [BrowsableAttribute(false)]
        public override System.Drawing.Font Font
        {
            get
            {
                return base.Font;
            }
            set
            {
                base.Font = value;
            }
        }
        [BrowsableAttribute(false)]
        public override System.Drawing.Color ForeColor
        {
            get
            {
                return base.ForeColor;
            }
            set
            {
                base.ForeColor = value;
            }
        }
        [BrowsableAttribute(false)]
        protected override ImeMode ImeModeBase
        {
            get
            {
                return base.ImeModeBase;
            }
            set
            {
                base.ImeModeBase = value;
            }
        }
        [BrowsableAttribute(false)]
        public override System.Windows.Forms.Layout.LayoutEngine LayoutEngine
        {
            get
            {
                return base.LayoutEngine;
            }
        }
        [BrowsableAttribute(false)]
        public override System.Drawing.Size MaximumSize
        {
            get
            {
                return base.MaximumSize;
            }
            set
            {
                base.MaximumSize = value;
            }
        }
        [BrowsableAttribute(false)]
        public override int PreferredHeight
        {
            get
            {
                return base.PreferredHeight;
            }
        }
        [BrowsableAttribute(false)]
        public override RightToLeft RightToLeft
        {
            get
            {
                return base.RightToLeft;
            }
            set
            {
                base.RightToLeft = value;
            }
        }
        [BrowsableAttribute(false)]
        protected override bool ScaleChildren
        {
            get
            {
                return base.ScaleChildren;
            }
        }
        [BrowsableAttribute(false)]
        public override System.Drawing.ContentAlignment TextAlign
        {
            get
            {
                return base.TextAlign;
            }
            set
            {
                base.TextAlign = value;
            }
        }
        [BrowsableAttribute(false)]
        public override int PreferredWidth
        {
            get
            {
                return base.PreferredWidth;
            }
        }

        [BrowsableAttribute(false)]
        protected override bool ShowFocusCues
        {
            get
            {
                return base.ShowFocusCues;
            }
        }
        [BrowsableAttribute(false)]
        protected override bool ShowKeyboardCues
        {
            get
            {
                return base.ShowKeyboardCues;
            }
        }
        [BrowsableAttribute(false)]
        public override ISite Site
        {
            get
            {
                return base.Site;
            }
            set
            {
                base.Site = value;
            }
        }
        #endregion
    }
}
